import 'package:flutter/material.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import 'package:xindong/manager/xindong_user_controller.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_banner_shitu.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_counter_shitu.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_function_shitu.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_header_shitu.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_money_shitu.dart';
import 'package:xindong/routes/tab_mine/view/xindong_wode_setting_shitu.dart';
import 'package:xindong/widgets/common/xindong_app_bar.dart';
import 'package:xindong/widgets/container/xindong_home_container.dart';

class XinDongWoDeYeMian extends StatefulWidget {
  const XinDongWoDeYeMian({super.key});

  @override
  State<XinDongWoDeYeMian> createState() => _XinDongWoDeYeMianState();
}

class _XinDongWoDeYeMianState extends State<XinDongWoDeYeMian> {
  final RefreshController _refreshController = RefreshController(initialRefresh: false);

  void _onRefresh() async {
    await XinDongUserController.to.requestUserInfo();
    _refreshController.refreshCompleted();
  }


  @override
  Widget build(BuildContext context) {
    return XinDongHomeBackgroundView(
      child: Scaffold(
        backgroundColor: Colors.transparent,
        appBar: XinDongAppBar("", leading: const SizedBox(), elevation: 0.0, toolbarHeight: 0.0, backgroundColor: Colors.transparent),
        body: SmartRefresher(
          controller: _refreshController,
          onRefresh: _onRefresh,
          child: ListView(
            padding: const EdgeInsets.only(bottom: 16),
            physics: const AlwaysScrollableScrollPhysics(),
            children: const [
              XinDongWoDeHeaderView(),
              XinDongWoDeCounterView(),
              XinDongWoDeMoneyView(),
              XinDongWoDeFunctionView(),
              XinDongWoDeSettingView(),
              XinDongWoDeBannerView(),
            ],
          ),
        ),
      ),
    );
  }
}
